#!/bin/bash

FILE=$1

if [ ! -f "$FILE" ]; then
  echo "The specified file does not exist."
  exit 1
fi

tr -cs '[:alnum:]' '[\n*]' < "$FILE" | sed 's/[A-Z]/\L&/g' | sort | uniq -c | sort -nr
